﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:n="http://nRoute/schemas/2010/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
	
	<!-- LINK ITEM TEMPLATE, NOTE_ the use of navigation behaviour and the transparent background -->    
	<DataTemplate x:Key="LinkTemplate">
		<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MinWidth="106" MinHeight="35" 
			Cursor="Hand" Background="Transparent">
            <TextBlock Margin="20,11,8,7" VerticalAlignment="Center" FontFamily="Segoe UI Symbol" 
                           FontSize="13" Text="{Binding Title}" TextWrapping="Wrap"/>
			<ItemsControl ItemsSource="{Binding ChildNodes}"
				ItemTemplate="{StaticResource LinkActionTemplate}"/>
		</StackPanel>
	</DataTemplate>
    
	<!-- LINK ACTION ITEM TEMPLATE, NOTE_ the use of ExecuteSiteMapNodeAction behaviour -->    
	<DataTemplate x:Key="LinkActionTemplate">
		<StackPanel Orientation="Horizontal" Margin="20,2,0,2" MinHeight="22" Cursor="Hand">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <n:ExecuteSiteMapNodeAction SiteMapNode="{Binding}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <i:Interaction.Behaviors>
                <n:BoolValueDisableBehavior Value="{Binding IsEnabled}" Negate="true" />
            </i:Interaction.Behaviors>
            <Image Source="{Binding IconPath}" Height="18" Width="18"  VerticalAlignment="Center" />
            <TextBlock Text="{Binding Title}"
                             Margin="8,0,0,0"
                             FontFamily="Segoe UI Symbol"
                             FontSize="12"
                             VerticalAlignment="Center">
            </TextBlock>
        </StackPanel>
	</DataTemplate>
	
	<!-- LIST BOX STYLE -->
	<Style x:Key="LinksListBoxStyle" TargetType="ListBox">
		<Setter Property="Padding" Value="0"/>
		<Setter Property="Background" Value="#FFFFFFFF"/>
		<Setter Property="Foreground" Value="#FF000000"/>
		<Setter Property="HorizontalContentAlignment" Value="Left"/>
		<Setter Property="VerticalContentAlignment" Value="Top"/>
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="TabNavigation" Value="Once"/>
        <Setter Property="BorderBrush"  Value="{x:Null}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBox">
					<Grid Background="{TemplateBinding Background}">
						<Path Stretch="Fill" Stroke="#FFD8D8DA" HorizontalAlignment="Right" Width="1" UseLayoutRounding="False" Data="M244,19 L244,97.025635"/>
						<Path Stretch="Fill" Stroke="#FFEEEFF1" HorizontalAlignment="Right" Margin="0,0,1,0" Width="1" UseLayoutRounding="False" Data="M244,19 L244,97.025635"/>
						<ScrollViewer x:Name="ScrollViewer" BorderThickness="0" 
								BorderBrush="{x:Null}" Padding="0,0,0,0">
							<ItemsPresenter/>
						</ScrollViewer>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<!-- CONTAINER STYLE -->
	<Style x:Key="LinkContainerStyle" TargetType="ListBoxItem">        
		<Setter Property="HorizontalContentAlignment" Value="Left"/>
		<Setter Property="VerticalContentAlignment" Value="Top"/>
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="TabNavigation" Value="Local"/>		
        <Setter Property="Padding" Value="0,0,0,5"/>
        <Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBoxItem">
					<Grid Background="{TemplateBinding Background}">
                        
						<!-- VISUAL STATES -->
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" 
											Storyboard.TargetProperty="Opacity">
											<SplineDoubleKeyFrame KeyTime="0" Value=".35"/>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" 
											Storyboard.TargetProperty="Opacity">
											<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="SelectionStates">
								<VisualState x:Name="Unselected"/>
								<VisualState x:Name="Selected">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames 
											Storyboard.TargetName="SelectedVisual" Storyboard.TargetProperty="Opacity">
											<SplineDoubleKeyFrame KeyTime="0" Value="1"/>
										</DoubleAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.Visibility)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
										<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="contentControl" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)">
											<EasingColorKeyFrame KeyTime="00:00:00" Value="White"/>
										</ColorAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="FocusStates">
								<VisualState x:Name="Focused"/>
								<VisualState x:Name="Unfocused"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
                        
						<!-- MOUSE OVER UNDERLAY -->
						<Rectangle x:Name="MouseOverVisual" Fill="#FFC4E9BA" RadiusX="1" RadiusY="1" 
							IsHitTestVisible="False" Opacity="0" Cursor="Hand"/>
						<Border BorderBrush="#FF3DB91C" BorderThickness="1,1,0,1"
							x:Name="SelectedVisual" Opacity="0">
                            
							<Border.Effect>
								<DropShadowEffect BlurRadius="8" Color="#044E4E4E" Direction="-51" ShadowDepth="3"/>
							</Border.Effect>
                            
							<Border.Background>
								<LinearGradientBrush EndPoint="0.987,0.515" StartPoint="0.048,0.533">
									<GradientStop Color="#FF53B939" Offset="0.996"/>
									<GradientStop Color="#FF43FF00" Offset="0.494"/>
									<GradientStop Color="#FF23C93E"/>
								</LinearGradientBrush>
							</Border.Background>
							<Rectangle Stroke="{x:Null}" StrokeThickness="0">
								<Rectangle.Fill>
									<RadialGradientBrush Center="0.38,0.983" GradientOrigin="0.38,0.983" RadiusX="1.023" RadiusY="0.81">
										<RadialGradientBrush.RelativeTransform>
											<TransformGroup>
												<ScaleTransform CenterX="0.37999999523162842" CenterY="0.98299998044967651"/>
												<SkewTransform CenterX="0.37999999523162842" CenterY="0.98299998044967651"/>
												<RotateTransform Angle="-50.346" CenterX="0.37999999523162842" CenterY="0.98299998044967651"/>
												<TranslateTransform/>
											</TransformGroup>
										</RadialGradientBrush.RelativeTransform>
										<GradientStop Color="#5923321E" Offset="1"/>
										<GradientStop Color="#FC3FFF00"/>
									</RadialGradientBrush>
								</Rectangle.Fill>
							</Rectangle>
                            
						</Border>
                            
						<!-- SIDE TRIANGLE -->
						<Path x:Name="path" Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" 
							Width="9" Height="20" VerticalAlignment="Top" Margin="0,10,0,0" Visibility="Collapsed"
							UseLayoutRounding="False" Data="M105.60668,13.132615 L99.708,18.177011 L105.60668,23.310255"/>
                                                    
                        <!-- CONTENT -->
						<ContentControl x:Name="contentControl" Foreground="Black">
							<ContentPresenter x:Name="contentPresenter" 
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
								Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" 
								ContentTemplate="{TemplateBinding ContentTemplate}"/>
	                     </ContentControl>
                        
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
</ResourceDictionary>